package com.yunhai.device.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yunhai.common.dto.PaginationVo;
import com.yunhai.common.dto.Ret;
import com.yunhai.device.service.DmsPullTeaMototimeService;
import com.yunhai.model.entity.dms.DmsPullTeaMototimeEntity;
import com.yunhai.model.vo.dms.DmsPullTeaMototimeQuery;
import com.yunhai.model.vo.dms.DmsPullTeaMototimeVo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/pullTeaMototime")
public class DmsPullTeaMototimeController {

    @Resource
    private DmsPullTeaMototimeService dmsPullTeaMototimeService;


    /**
     * 获取 DmsPullTeaMototime 分页列表
     */
    @GetMapping("/pagination")
    public Ret getDmsPullTeaMototimePagination(PaginationVo paginationVo, DmsPullTeaMototimeQuery dmsPullTeaMototimeQuery ) throws Exception {
        IPage page = dmsPullTeaMototimeService.getDmsPullTeaMototimePagination(paginationVo, dmsPullTeaMototimeQuery );
        return Ret.toPage(page);
    }


    /**
     * 获取 DmsPullTeaMototime 所有数据
     */
    @GetMapping("/all")
    public Ret getDmsPullTeaMototimeAllList( DmsPullTeaMototimeQuery dmsPullTeaMototimeQuery ) throws Exception {
        List<DmsPullTeaMototimeEntity> list = dmsPullTeaMototimeService.getDmsPullTeaMototimeAllList( dmsPullTeaMototimeQuery );
        return Ret.ok(list);
    }



    /**
     * 获取 DmsPullTeaMototime 详情
    */
   @GetMapping("/{id}")
   public Ret getDmsPullTeaMototimeDetail(@PathVariable Long id) throws Exception {

       DmsPullTeaMototimeEntity dmsPullTeaMototime = dmsPullTeaMototimeService.getDmsPullTeaMototimeDetail(id);
       return Ret.ok(dmsPullTeaMototime);
   }


    /**
     * 新增 DmsPullTeaMototime
     * */
    @PostMapping("")
    public Ret addDmsPullTeaMototime(@RequestBody DmsPullTeaMototimeVo dmsPullTeaMototimeVo) throws Exception {

        dmsPullTeaMototimeService.addDmsPullTeaMototime(dmsPullTeaMototimeVo);
        return Ret.ok();
    }


    /**
     * 更新 DmsPullTeaMototime
     * */
    @PutMapping("")
    public Ret updateDmsPullTeaMototime(@RequestBody DmsPullTeaMototimeVo dmsPullTeaMototimeVo) throws Exception {

        dmsPullTeaMototimeService.updateDmsPullTeaMototime(dmsPullTeaMototimeVo);
        return Ret.ok();
    }


    /**
     * 删除 DmsPullTeaMototime
     * */
    @PostMapping("/batchRemove")
    public Ret batchRemoveDmsPullTeaMototime( @RequestBody List<Long> ids ) throws Exception {

        dmsPullTeaMototimeService.batchRemoveDmsPullTeaMototime(ids);
        return Ret.ok();
    }
}

  